import { generateXML } from './XML/main'

export class XMLExporter {
  constructor(pathObject, mediaInfo, fragmentArray) {
    this.pathObject = pathObject
    this.mediaInfo = mediaInfo
    this.fragmentArray = fragmentArray
    this.filePrefix = '[autocut.video]'
  }
  async download() {
    const pairs = this.fragmentArray
    const xml = generateXML(this.pathObject, this.mediaInfo, pairs)

    console.log('pr项目xml', xml)
    // vlevin @ 2023-01-16 浏览器无法向特定目录中写文件，仅作参考
    // const fileName = `${this.filePrefix}${decodeURI(this.pathObject.name)}.xml`
    // fs.writeFileSync(xml, fileName)
    // console.log(`已保存${fileName}到当前目录`)
  }
}
